#include<stdio.h>
int main(){
	int week,pollute,number;
	scanf("%d %d %d",&week,&pollute,&number);
	int foot=number%10;
	printf("%d ",foot);
	if(pollute<200||week==6||week==7) printf("no");
	else if(pollute<=400){
		switch(week){
			case 1:if(foot==1||foot==6) printf("yes");
					else printf("no");break;
			case 2:if(foot==2||foot==7) printf("yes");
					else printf("no");break;
			case 3:if(foot==3||foot==8) printf("yes");
					else printf("no");break;
			case 4:if(foot==4||foot==9) printf("yes");
					else printf("no");break;
			case 5:if(foot==5||foot==0) printf("yes");
					else printf("no");break;						
		}
	}
	else if(pollute<=600){
		switch(foot){
			case 1:
			case 3: 
			case 5:
			case 7:
			case 9:if(week==1||week==3||week==5) printf("yes");
					else printf("no");break;
			case 2:
			case 4:
			case 6: 
			case 8:
			case 0:if(week==2||week==4) printf("yes");
					else printf("no");break;
		}
	}
	
} 
